#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#include<time.h>
#include <ctype.h>

int proverka(char shtuka[], int n, int n1)
{
	char vvod[1000];
	int the_end = 1, i,zapuski=0, flag=0 , oshibka=0;
	getchar();
	
	for(i = n1; i<n; i++){

		vvod[i] = getchar();
		
		if (vvod[i] == '\n'){
			
			printf(" \n nu vu dage ne vveli do konca, vvedite vse do konca\n");
			i = i - 1;
			}
		else {
		if (vvod[i] != shtuka[i] && oshibka!=1 ){
			n1 = i; 
			oshibka=1;

		}
	}
	}

	


	if (oshibka == 1 ){
		printf("stop, vu vveli %c vmesto %c \n" ,vvod[n1], shtuka[n1]);
		printf("vvedite zanogo simvolu nachinaya s simvola %c \n",shtuka[n1]);
		proverka( shtuka,n,n1);
	}

	if (oshibka == 0 && zapuski == 0) {
		printf(" pozdravlyau, kakoy vu molodec nabrali vsu stroku bez oshibok\n");
		return 0;
	
	}

	zapuski++;
	return 0;
}

void main ()
{
	char shtuka[1000];
	int i,flag = 1, nomer;
	int n,n1='\0';
	srand(time(0));

	printf("vvediti dlinu trenazhernoy stroki\n");
	scanf("%d", &n);

	printf("\n");

	printf("eto vasha stroka vvedite ee s klaviaturu");
	printf("\n");

	for(i = 0; i<n;i++){
		while (true){
			nomer=rand()%256;
			if (isprint(nomer)){
				shtuka[i]=nomer;
				printf("%c", shtuka[i]);
				break;
			}
		}
	}

	printf("\n");

	proverka(shtuka,n,n1);	
	printf("\n");

	printf("\n");
	system("pause");
}


